import java.util.Date;

import javax.persistence.EntityManager;

import training.bms.business.Blog;
import training.bms.business.Post;
import training.bms.persistence.ManagerStrategy;
import training.bms.persistence.ManagerUtil;

public class OneToManyTest {
	public static void main(String args[]) {
		new ManagerUtil().execute(
			new ManagerStrategy() {				
				@Override
				public void execute(EntityManager manager) {
					Blog blog = new Blog();
					blog.setName("Blog");
					blog.setCreationDate(new Date());
					
					Post post = new Post();
					post.setTitle("Post");
					post.setContent("Blah blah blah");
					post.setCreationDate(new Date());
					
					post.setBlog(blog);
					
					manager.persist(blog);
					manager.persist(post);
				}
			}
		);
	}
}
